<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>MINI</title>
</head>
<body>
    
</body>
</html>


<script>
    //mini类也可以继承其他类，比如下面的Create类获取积分，此类要请求后台，需要继承Request类来完成
    //super 当前类的原型
    function extend(sub,sup){
        sub.prototype = Object.create(sup.prototype);
        sub.prototype.constructor = sub;
    }

    function User(name,age){
        this.name = name;
        this.age = age;
    }

    User.prototype.show = function(){
        console.log(this.name,this.age);
    }

    const Request = {
        ajax(){
            return "请求后台";
        }
    };

    const Credit = {
        __proto__ : Request,
        total(){
            console.log(super.ajax()+",统计积分");
        }
    };

    function Admin(...args){
        User.apply(this,args);
    }
    Object.assign(User.prototype,Request,Credit);
    extend(Admin,User);
    let hd = new Admin("向军",19);
    // hd.show();
    console.dir(hd)

</script>